package org.wekit.engine.pvm.runtime;

import org.wekit.engine.pvm.PvmEvent;
import org.wekit.engine.pvm.process.Activity;
import org.wekit.engine.pvm.process.Scope;

/**
 * 节点结束触发机制
 * @author HuangWeili
 *
 */
public class AtomicOperationActivityEnd extends AbstractEventAtomicOperation {

	@Override
	protected Scope getScope(InterpretableExecution execution) {
		return (Scope)execution.getActivity();
	}

	@Override
	protected String getEventName() {
		return PvmEvent.EVENTNAME_END; //结束动作
	}

	@Override
	protected void eventNotificationsCompleted(InterpretableExecution execution) {
		Activity activity=(Activity)execution.getActivity();
		Activity parentActivity=activity.getParentActivity();
		if((parentActivity!=null)&&(!parentActivity.isScope()))
		{
			
		}else if(execution.isProcessInstance())
		{
			execution.performOperation(new AtomicOperationProcessEnd());
		}
		
	}

	
}
